<template>
  <div class="box">
    HelloWorld
  </div>
  <div>
    <input type="number" v-model="num" />
    {{ formatNum() }}
    <button @click="add">添加</button>
  </div>
</template>
<script>
  import moment from 'moment'
  export default {
    data() {
      return {
        num: ''
      }
    },
    computed: {},
    methods: {
      add() {
        console.log(`HelloWorld`)
        let m = moment()
        let flag = m.startOf('day') === m.endOf('day')
        console.log(flag)
      },
      formatNum() {
        /*let num = '1928388383'*/
        let num = this.num + ''
        let numReg = /\B(?=(\d{3})+(?!\d))/g
        /*let numReg = /\B(?=(\d{3})+(?!\d))/*/
        let numArr = num.replace(numReg, ',')
        return numArr
      },
      test() {
        let text = 'my string text'
        let reg = /\bstring\b/
        let arr = text.match(reg)
        console.log(arr)
      }
    },
    mounted() {
      let reg = /(?=strings)/
      let text = `mystringsother`
      let arr = text.replace(reg, ',')
      console.log(arr)
      this.test()
    }
  }
</script>
<style type="text/css">
  .box {
    width: 100px;
    height: 100px;
    border: 1px solid #000;
  }
</style>
